<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Registers a new monitoring event subscriber</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.mongodb.driver.monitoring.addsubscriber" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\Monitoring\addSubscriber</h1>
  <p class="verinfo">(mongodb &gt;=1.3.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\Monitoring\addSubscriber</span> &mdash; <span class="dc-title">Registers a new monitoring event subscriber</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mongodb.driver.monitoring.addsubscriber-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>MongoDB\Driver\Monitoring\addSubscriber</strong></span>
    ( <span class="methodparam"><span class="type"><span class="type MongoDB\Driver\Monitoring\Subscriber">MongoDB\Driver\Monitoring\Subscriber</span></span> <code class="parameter">$subscriber</code></span>
   ) : <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   Registers a new monitoring event subscriber with the driver. Registered
   subscribers will be notified of monitoring events through specific methods.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    If the object is already registered, this function is a no-op.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mongodb.driver.monitoring.addsubscriber-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">subscriber</code> (<span class="type"><span class="type MongoDB\Driver\Monitoring\Subscriber">MongoDB\Driver\Monitoring\Subscriber</span></span>)</dt>

    <dd>

     <p class="para">
      A monitoring event subscriber object to register.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mongodb.driver.monitoring.addsubscriber-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mongodb.driver.monitoring.addsubscriber-errors">
  <h3 class="title">错误／异常</h3>
  <ul class="simplelist">
   <li class="member">Throws <a href="class.mongodb_driver_exception_invalidargumentexception.html" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a> on argument parsing errors.</li>
  </ul>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mongodb.driver.monitoring.addsubscriber-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="interfacename"><a href="class.mongodb_driver_monitoring_subscriber.html" class="interfacename">MongoDB\Driver\Monitoring\Subscriber</a></span></li>
   <li class="member"><span class="interfacename"><a href="class.mongodb_driver_monitoring_commandsubscriber.html" class="interfacename">MongoDB\Driver\Monitoring\CommandSubscriber</a></span></li>
   <li class="member"><span class="function"><a href="mongodb.driver.monitoring.removesubscriber.html" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Monitoring\removeSubscriber()</a> - Unregisters an existing monitoring event subscriber</span></li>
   <li class="member"><a href="mongodb.tutorial.apm.html" class="xref">Application Performance Monitoring (APM)</a></li>
  </ul>
 </div>


</div></div></div></body></html>